// 主页面标签跳转

export default function () {
    /**
     * 
     * 根据id跳转
     * scrollIntoView 滚动参数：（有兼容性问题）
     * {
     *    behavior: "auto"  | "instant" | "smooth",
     *    block:    "start" | "end",
     * }
     * smooth 平滑的滚动 instant 瞬间 auto 默认
     * start 视口顶部齐平 end 视口底部
     */

    // 地区风险
    const goAreaRisk = ()=>{
        document.getElementById('arearisk').scrollIntoView({
            block: 'start',
            behavior: 'smooth'
        })
    }

    // 国内数据
    const goCovNumber = ()=>{
        document.getElementById('covnumber').scrollIntoView({
            block: 'start',
            behavior: 'smooth'
        })
    }

    // 全球数据
    const goGlobalNumber = ()=>{
        document.getElementById('globalnumber').scrollIntoView({
            block: 'start',
            behavior: 'smooth'
        })
    }

    // 新冠疫苗
    const goVaccine = ()=>{
        document.getElementById('vaccine').scrollIntoView({
            block: 'start',
            behavior: 'smooth'
        })
    }

    return {
        goAreaRisk,
        goCovNumber,
        goGlobalNumber,
        goVaccine
    }
}